1. Technical Field
The present invention relates to systems and methods for adapting program codes for execution on different computer systems and more particularly to systems and methods for reporting errors in an original program during the execution of a translation of the original program.
2. Background Art
In the early years of computer programming, instructions for computer programs were generated at the microcode level. With the development and growth of software engineering, more tasks were combined in single complex instructions executable by computers having a hardware architecture designed for the instruction complexity.
Increasing instruction complexity generally provided increasing price/performance benefits in the developing environment of computer hardware costs and performance capabilities. As a result, complex instruction set codes (CISC) became widely accepted.
With increased instruction complexity, however, it has become more difficult to design system hardware for higher execution speed. Instead, a reduced instruction set code (RISC), coupled with correlated RISC computer hardware architecture, has gained acceptance as a mechanism to lead to significantly improved system price/performance.
A RISC system generally employs simpler basic instructions to direct desired operations. A single RISC instruction normally specifies a single operation with at most a single memory access. Further, a RISC system normally provides a register for each basic instruction. The instructions in a RISC instruction set are thus still at a higher level than microcode.
In the typical CISC system, a single instruction may specify a complex sequence of operations and it may make many direct accesses to memory. Thus, operations performed by a CISC instruction may require several RISC instructions.
A RISC system is generally designed with optimized hardware and software tradeoffs that provide faster system operation, better overall system performance and lower system cost relative to available hardware cost and performance capability.
One obstacle to conversion from CISC systems to RISC systems is the existence of large software libraries which have been developed for CISC systems and which are not generally available for RISC systems. When a computer system user chooses to acquire a new computer system, one of the user's major considerations is whether the user's library of application programs can be used or converted for use on the new computer system, and what the cost of replacing that library would be. Thus, for computer system users who wish to achieve better price/performance through RISC computer systems, it is highly important that an economic and effective mechanism be provided for adapting, or "migrating" the user's library of application programs for execution on the RISC computer system.
Several choices are available to the user for program migration. Recompiling or recoding can be employed, but these techniques are typically used for migrating programs written in a high level language such as FORTRAN which either have no detailed machine dependencies or which have any existing machine dependencies removed by manual programming modifications. Further, in recompiling or recoding, the user typically bears all responsibility for program modification and program behavioral guarantees.
Alternatively, interpretation procedures can be used, but the penalty for this approach typically is substantially reduced program performance. More particularly, interpretation procedures are software programs that run on one computer and read a stream of subject instructions (which may well be instructions for a different type of computer) as data, and for each subject instruction perform the indicated operation. Such procedures typically execute 10 to 100 machine instructions on the one computer to interpret a single subject instruction. Thus, interpretation procedures provide substantially reduced program performance, compared to direct execution of functionally-equivalent code on the one computer.
The most effective and efficient migration, however, involves code translation. In code translation, each instruction from an existing program is translated into one or more instructions in the language of the destination machine. Accordingly, a translation of CISC programs to RISC programs, or more generally a program translation in which the translated code has a relatively reduced instruction set, requires "multiple" or "many" instructions in the translated code for each instruction in the code being translated.
A problem resulting from CISC to RISC code translation is that when execution of the translated program aborts due to an error, information about the error is usually based upon the state of the RISC machine. Debugging programs typically associated with high-level CISC source code, however, assume that information about an error is based upon the state of a CISC machine. A debugging program, for example, uses debug information generated when the CISC source code is compiled into CISC object code. The debug information typically includes information associating symbolic (ASCII) names with numerical CISC program and data addresses. The debugging program uses this symbolic name information to permit the programmer to inspect the contents of memory in the CISC machine at addresses specified by selected symbolic names. Typically the debug information also includes traceback information associating line numbers in the CISC source code with corresponding numerical addresses in the CISC object code. When an error occurs during execution of the CISC program in the CISC machine, the operating system in the CISC machine reads a hardware register in the CISC machine to determine the address of the CISC instruction causing the error. The operating system passes this address to an error reporting program that references the traceback information to report to the programmer the line number of the CISC source code from which the error originated.
Because the debugging programs associated with the compilation of CISC source code are based upon CISC object code addresses, CISC instructions, and hardware in the CISC machine, they do not provide the debugging of CISC source code during execution of a translated program on a RISC machine. The debugging of CISC source code during execution of a corresponding RISC object program on a RISC machine could be done by a debug program referencing debug information generated by compiling the CISC source program directly to RISC object code, but this technique would require re-compilation of the CISC source code. Moreover, in some cases CISC source code has been lost or destroyed so that re-compilation is not possible.